package datamining.miner.general;

import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;

import datamining.common.Frequented;
import datamining.sequence.Sequence;

/**
 * <p>
 * 创建于 2012-12-2 下午9:54:34
 * 
 * @author xujinghu (jinghuxu@nudt.edu.cn) <br>
 *         Copyright 2012 xujinghu <br>
 *         Lisence: Apache
 */
public interface Fragment<ItemType> extends Collection<Embedding<ItemType>>,
		Frequented, Serializable {

	/**
	 * Adds just the given graph to the graph collection but no embeddings
	 * 
	 * @param db
	 * @throws UnsupportedOperationException
	 *                 if not available
	 */
	public void add(IndexedSequence<ItemType> db) throws UnsupportedOperationException;

	/**
	 * @return a copy of this fragment
	 */
	public Fragment<ItemType> copy();

	/**
	 * @return a graph representing this fragment
	 */
	public Sequence<ItemType> toSequence();

	/**
	 * @return an iterator over the sequences this fragment is part of
	 */
	public Iterator<IndexedSequence<ItemType>> dbIterator();
	
	/**
	 * @return all embeddings, if stored
	 */
	public Collection<Embedding<ItemType>> getEmbeddings();

}
